export const backupConfig = {
  // 数据库备份
  database: {
    enabled: true,
    // MySQL备份
    mysql: {
      enabled: true,
      tool: 'D:\\MySQL\\bin\\mysqldump.exe', // Windows路径
      databases: ['livechat'],
      options: {
        compress: true,
        // 备份计划
        schedule: {
          full: '0 2 * * 0', // 每周日凌晨2点完整备份
          incremental: '0 3 * * 1-6', // 工作日凌晨3点增量备份
        },
      },
    },
    // Redis备份
    redis: {
      enabled: true,
      type: 'rdb', // RDB备份
      schedule: '0 4 * * *', // 每天凌晨4点
      path: 'D:\\livechat\\backups\\redis',
    },
  },

  // 文件备份
  files: {
    enabled: true,
    // 本地备份
    local: {
      path: 'D:\\livechat\\backups\\files',
      // 备份内容
      targets: [
        {
          name: 'uploads',
          path: 'D:\\livechat\\storage\\uploads',
          exclude: ['*.tmp', '*.temp'],
        },
        {
          name: 'configs',
          path: 'D:\\livechat\\config',
          compress: true,
        },
      ],
    },
    // 云存储备份
    cloud: {
      enabled: true,
      type: 'oss', // 阿里云OSS
      bucket: 'backup-bucket',
      region: 'oss-cn-hangzhou',
      path: 'livechat/backups',
      retention: 30, // 保留30天
    },
  },

  // 部署配置
  deployment: {
    // 环境配置
    environment: {
      // 开发环境
      development: {
        port: 3000,
        database: 'livechat_dev',
        logLevel: 'debug',
      },
      // 测试环境
      testing: {
        port: 3001,
        database: 'livechat_test',
        logLevel: 'info',
      },
      // 生产环境
      production: {
        port: 80,
        database: 'livechat_prod',
        logLevel: 'warn',
      },
    },

    // 服务配置
    services: {
      // Node.js服务
      node: {
        command: 'D:\\Program Files\\nodejs\\node.exe',
        script: 'D:\\livechat\\server\\dist\\index.js',
        // PM2配置
        pm2: {
          name: 'livechat',
          instances: 4,
          maxMemory: '2G',
          logFile: 'D:\\livechat\\logs\\pm2',
        },
      },
      // Nginx配置
      nginx: {
        enabled: true,
        path: 'D:\\nginx',
        config: 'D:\\nginx\\conf\\nginx.conf',
        // SSL证书
        ssl: {
          enabled: true,
          cert: 'D:\\certificates\\server.crt',
          key: 'D:\\certificates\\server.key',
        },
      },
    },

    // 自动化部署
    automation: {
      // Jenkins配置
      jenkins: {
        enabled: true,
        url: 'http://jenkins.local:8080',
        job: 'livechat-deploy',
        token: process.env.JENKINS_TOKEN,
      },
      // 部署脚本
      scripts: {
        preInstall: 'D:\\livechat\\scripts\\pre-install.bat',
        postInstall: 'D:\\livechat\\scripts\\post-install.bat',
        rollback: 'D:\\livechat\\scripts\\rollback.bat',
      },
    },
  },

  // 监控恢复
  recovery: {
    // 自动恢复
    auto: {
      enabled: true,
      maxAttempts: 3,
      // 服务监控
      services: [
        {
          name: 'node',
          check: 'http://localhost:3000/health',
          restart: 'pm2 restart livechat',
        },
        {
          name: 'redis',
          check: 'redis-cli ping',
          restart: 'net stop Redis && net start Redis',
        },
      ],
    },
    // 数据恢复
    data: {
      mysql: {
        tool: 'D:\\MySQL\\bin\\mysql.exe',
        scripts: {
          restore: 'D:\\livechat\\scripts\\restore-mysql.bat',
        },
      },
      redis: {
        scripts: {
          restore: 'D:\\livechat\\scripts\\restore-redis.bat',
        },
      },
    },
  },
}
